﻿var formatPriority = function (elCell, oRecord, oColumn, sData) {
    var showText;
    if (sData == "1") {
        showText = "<font color='red'>特急</font>";
    } else if (sData == "2") {
        showText = "<font color='green'>紧急</font>";
    } else {
        showText = "普通";
    }
    elCell.innerHTML = showText;
}

var formatOperate = function (elCell, oRecord, oColumn, sData) {
    var OperatorInstanceId = oRecord.getData("OperatorInstanceId");
    var oid = '"' + OperatorInstanceId + '"';
    elCell.innerHTML = "<a href='javascript:DoTask(" + oid + ")'>放弃</a><br />";
}
var DoTask = function (obj) {
    var cObj = YAHOO.util.Connect.asyncRequest('POST', "../../Extend/AjaxData/WorkFlowTask.aspx?action=taskUnFlow&operatorInstanceId=" + obj, callback);

}
var formatShow = function (elCell, oRecord, oColumn, sData) {
    var WorkFlowInstanceId = oRecord.getData("WorkFlowInstanceId");
    var workflowId = oRecord.getData("WorkFlowId");
    var taskCaption = oRecord.getData("TaskCaption");
    var url = '"' + "../../Crm/BasePages/WorkflowMap.aspx?WorkFlowInstanceId=" + WorkFlowInstanceId + "&workflowId=" + workflowId + '"';
    var title = '"' + taskCaption + '流程图"';
    elCell.innerHTML = "<a href='javascript:transForForm(" + title + "," + url + ")'>流程图</a><br />";
}
var transForForm = function (title, url) {
    parent.addTabs(title, url);
    parent.NeedRefreshPage = this;
}
var formatCaption = function (elCell, oRecord, oColumn, sData) {
    var WorkTaskInstanceId = oRecord.getData("WorkTaskInstanceId");
    var OperatorInstanceId = oRecord.getData("OperatorInstanceId");
    var url = '"' + "../../Crm/BasePages/WorkTaskCtrlPage.aspx?WorkTaskInstanceId=" + WorkTaskInstanceId + "&OperatorInstanceId=" + OperatorInstanceId + '"';
    var title = '"' + sData + '"';
    elCell.innerHTML = "<a href='javascript:transForForm(" + title + "," + url + ")'>" + sData + "</a><br />";
}
var responseSuccess = function (res) {
    try {
        var str = res.responseText;
        if (str == "1") {
            alert("操作成功"); fnReload();
        }
        else {
            alert(str);
        }
    } catch (e) {
    }
    finally {
    }
};

var responseFailure = function (error) {
    alert("数据错误：" + error.statusText);
}
var callback = {
    success: responseSuccess,
    failure: responseFailure
};
//自动义双击方法
function CustomDbClick() { }